package com.woniuxy.lrz.carlproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.lrz.carlproject.common.AppException;
import com.woniuxy.lrz.carlproject.model.ServiceFirstLevel;
import com.woniuxy.lrz.carlproject.dao.ServiceFirstLevelMapper;
import com.woniuxy.lrz.carlproject.model.ShopService;
import com.woniuxy.lrz.carlproject.service.ServiceFirstLevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 一级分类服务表 服务实现类
 * </p>
 *
 * @author lrz
 * @since 2022-09-28
 */
@Service
public class ServiceFirstLevelServiceImpl extends ServiceImpl<ServiceFirstLevelMapper, ServiceFirstLevel> implements ServiceFirstLevelService {


    @Resource
    ServiceFirstLevelMapper serviceFirstLevelMapper;
    @Override
//    @Cacheable(cacheNames = "serviceFirstLevel" )
    public Page<ServiceFirstLevel> getAll(int current, int size) {
        Page<ServiceFirstLevel> firstLevelPage = serviceFirstLevelMapper.selectPage(new Page<ServiceFirstLevel>(current, size), new QueryWrapper<ServiceFirstLevel>());
        if (firstLevelPage==null){
            throw new AppException("查询一级服务失败");
        }
        return firstLevelPage;
    }
}
